#include <limits.h>
#include "gtest/gtest.h"
#include "../include/HttpDataSource.h"
#include "./subs/HttpClientSub.h"
#include "../include/WindowsHttpClient.h"

#define MBYTE 1024*1024
// Tests factorial of negative numbers.
TEST(HttpDataSourceTest,GetDataSourceStatus) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	HttpClientSub* pHttpClient=new HttpClientSub();
	HttpDataSource* pDataSource=new HttpDataSource(pHttpClient);
	pDataSource->SetStatusURL("status");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nResult=pDataSource->GetStatusJson(pJsonBuf,nBufferSize);
	ASSERT_EQ(0,nResult);
	
	//ASSERT_STRNE("", strStatus);

}

TEST(HttpDataSourceTest,GetSlots) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	HttpClientSub* pHttpClient=new HttpClientSub();
	HttpDataSource* pDataSource=new HttpDataSource(pHttpClient);
	pDataSource->SetSlotsURL("slots");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nResult=pDataSource->GetSlotsJson(pJsonBuf,nBufferSize);
	ASSERT_EQ(0,nResult);


}

TEST(HttpDataSourceTest,GetAdList) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	HttpClientSub* pHttpClient=new HttpClientSub();
	HttpDataSource* pDataSource=new HttpDataSource(pHttpClient);
	pDataSource->SetAdListURL("adlist");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nResult=pDataSource->GetAdListJson(1,10,pJsonBuf,nBufferSize);
	ASSERT_EQ(0,nResult);


}

/*

TEST(HttpDataSourceTest,RealHttpRequest) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	HttpClient* pHttpClient=new WindowsHttpClient();
	HttpDataSource* pDataSource=new HttpDataSource(pHttpClient);
	pDataSource->SetAdListURL("adlist");
	char* pJsonBuf=new char[10*MBYTE];
	int nResult=pDataSource->GetAdListJson(1,10,pJsonBuf,10*MBYTE);
	ASSERT_EQ(0,nResult);


}
*/